package com.liyongjian.xhban;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.liyongjian.xhban.interceptor.LoggerInterceptor;


@SpringBootApplication
@EnableScheduling
@ServletComponentScan
public class XHBanServer extends WebMvcConfigurerAdapter {

    public static void main(String[] args) {
        SpringApplication.run(XHBanServer.class, args);
        System.out.println(new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss]").format(new Date())
                + " echat service server started!");
    }

    /**
     * 配置拦截器
     * 
     * @author lance
     * @param registry
     */
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoggerInterceptor()).addPathPatterns("/**");
    }


}
